GtkEntry: Added gtk_entry_grab_focus_without_selection()
authorAnkita Patil <patil.ankita.r@gmail.com>
Thu, 6 Nov 2014 12:16:02 +0000 (17:46 +0530)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 6 Dec 2014 04:17:25 +0000 (23:17 -0500)
Providing a way to focus an entry without selecting its contents.

https://bugzilla.gnome.org/show_bug.cgi?id=735838

docs/reference/gtk/gtk3-sections.txt
gtk/gtkentry.c
gtk/gtkentry.h

index 994a1500f0c2f2d8b151b4dab4fe483f5335cfcc..6c34734865bba598f1d714b703f0f755fdc3ec29 100644 (file)
@@ -1196,6 +1196,7 @@ gtk_entry_get_input_purpose
 GtkInputHints
 gtk_entry_set_input_hints
 gtk_entry_get_input_hints
+gtk_entry_grab_focus_without_selecting
 
 <SUBSECTION Standard>
 GTK_ENTRY
index 4be143c5ea036a1992b89ad344c3548053d8bf51..73d0a821c424625bcc2777a1b5100ce02b5d6be6 100644 (file)
@@ -5016,6 +5016,28 @@ gtk_entry_grab_focus (GtkWidget *widget)
     }
 }
 
+/**
+ * gtk_entry_grab_focus_without_selecting:
+ * @entry: a #GtkEntry
+ *
+ * Causes @entry to have keyboard focus.
+ *
+ * It behaves like gtk_widget_grab_focus(),
+ * except that it doesn't select the contents of the entry.
+ * You only want to call this on some special entries
+ * which the user usually doesn't want to replace all text in,
+ * such as search-as-you-type entries.
+ *
+ * Since: 3.16
+ */
+void
+gtk_entry_grab_focus_without_selecting (GtkEntry *entry)
+{
+  g_return_if_fail (GTK_IS_ENTRY (entry));
+
+  _gtk_entry_grab_focus (entry, FALSE);
+}
+
 static void
 gtk_entry_direction_changed (GtkWidget        *widget,
                              GtkTextDirection  previous_dir)
index ce3c021eca584f0171420bdde689cd8ed4600358..57d65a575653e5aa7fdda949f2398ddff305461c 100644 (file)
@@ -374,6 +374,9 @@ void            gtk_entry_set_tabs                           (GtkEntry
 GDK_AVAILABLE_IN_3_10
 PangoTabArray  *gtk_entry_get_tabs                           (GtkEntry             *entry);
 
+GDK_AVAILABLE_IN_3_16
+void           gtk_entry_grab_focus_without_selecting        (GtkEntry             *entry);
+
 G_END_DECLS
 
 #endif /* __GTK_ENTRY_H__ */